home *** CD-ROM | disk | FTP | other *** search
- Path: holly.ACNS.ColoState.EDU!not-for-mail
- From: corbyh@holly.ACNS.ColoState.EDU (Corby S. Hudnall)
- Newsgroups: comp.lang.c++
- Subject: Re: Circular Usage (forward declaration?)
- Date: 16 Apr 1996 19:11:11 -0600
- Organization: Colorado State University, Fort Collins, CO 80523
- Distribution: world
- Message-ID: <4l1gff$142e@holly.ACNS.ColoState.EDU>
- References: <MRW.96Apr16184800@tobago.siemens.ch>
- NNTP-Posting-Host: holly.acns.colostate.edu
- X-Newsreader: TIN [version 1.2 PL2]
-
- Waeckerlin Marc wrote:
- : class A
- : {
- : B x;
- : };
-
- : class B
- : {
- : A x;
- : };
- As your title implies, use a forward declaration of B like so:
-
- class B;
-
- class A { B* Bptr; };
-
- class B { A* Aptr; };
-
- You can of course expand this example to do whatever you need it to.
- Good Luck.
-
- // ------------ BEGIN SIGNATURE ---------------
- #include <iostream.h>
- void main(void)
- {
- cout << "\aName:\tCorby S. Hudnall\n"
- << "School:\tColorado State University\n"
- << "\tDepartement of Computer Science\n"
- << "EMail:\thudnall@CS.ColoState.EDU\n"
- << "URL:\thttp://WWW.CS.ColoState.EDU/~hudnall\n";
- }
- // ------------ END SIGNATURE -----------------
-
-